<?php
	include(ROOTPATH .'include'. DS .'protect.php');
	include(ROOTPATH .'include'. DS .'checkUserLogin.php');
	include "header.php"; 
	
	
	
?>

<script type="text/javascript">var uploadType = <?php echo $id == 0 && $task_id == 0 ? 'true' : 'false';?>  ? 'upload' : 'edit' ;</script>

<script type="text/javascript" src="<?php echo HOSTROOT;?>min/f=<?php echo ROOT_PATH;?>jslab/jquery-ui.min.js,<?php echo ROOT_PATH;?>jslab/jquery.ui.sortable.js,<?php echo ROOT_PATH;?>upload/scripts/swfobject.js,<?php echo ROOT_PATH;?>upload/scripts/jquery.upload.min.js,<?php echo ROOT_PATH;?>js/upload.js"></script>


<?php /*?><script type="text/javascript" src="<?php echo JSLAB_PATH;?>jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo JSLAB_PATH;?>jquery.ui.sortable.js"></script>
<script type="text/javascript" src="<?php echo WEB_ROOT_PATH;?>upload/scripts/swfobject.js"></script>
<script type="text/javascript" src="<?php echo WEB_ROOT_PATH;?>upload/scripts/jquery.upload.min.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>upload.js"></script><?php */?>

<?php echo loadEdit('#description','comment') ;?>


<?php
/*
<link rel="stylesheet" href="jCrop/css/jquery.Jcrop.css" type="text/css" />
<script src="jCrop/js/jquery.Jcrop.min.js"></script>
<script language="Javascript" src="jCrop/js/do.js"></script>
*/
?>
</head>
<body>
<?php require('top.php'); ?>
<div class="pos">	
    <div class="contents">
		<?php require('nav.php'); ?>
        <h2 class="title"><?php echo $navigation -> getList();?></h2>
        <div id="upload">        
        <form action="<?php echo WEB_ROOT_PATH;?>?option=uploadAction&type=action" method="post" enctype="multipart/form-data" name="uploadForm" class="form upload" id="uploadForm">
        <ul class="box">
        <li class="highBig"><?php echo lang_works_file;?></li>
        <?php /*<li><input type="submit" value="上传作品" class="submit" /> </li> */?>
        <li><input type="file" name="mediaFile" id="mediaFile" /><span class="tips">(<?php echo lang_upload_file_tip;?>)</span></li>
        </ul>        
        <div class="mediaListTitle"><span class="order"><?php echo lang_sort;?></span><span class="name"><?php echo lang_name;?></span><span class="title"><?php echo lang_description;?></span><span class="press"><?php echo lang_progress;?></span></div>        
        <ul class="box">
        	<div id="fileQueue"><?php echo getMediaFiles($show['file'],$show['fileTitles'],$show['fileDescription']); ?></div>
        </ul>
        <hr />
        <ul class="box">
        <li><label class="highBig"><?php echo lang_works_title;?></label><input id="fileName" class="text shiningTFD" value="<?php echo $show['name'];?>" name="fileName" type="text" maxlength="40" /><h4><?php echo lang_you_can_also_enter ;?><span id="fileNameNum" class="titleNum limitLen"></span><?php echo lang_characters ;?></h4></li>
        <hr />
        <?php /*?><li class="highBig"><?php echo lang_add_tag;?></li><?php */?>
		<?php getTagMenu($all = false,$selected = $show['tag']); ?>
         
        <hr />
        
        <li class="tagMenu"><label ids="3" class="highBig"><?php echo lang_custom_tag?></label>
                <div id="tagList" class="tagListCustom">
                <?php
                    //1!1,2,3,4,5|3!119,120,121
                     echo $tag -> getCustomMenu($show['tag'],'file');
                ?>
                </div>
                <input id="customizeTag" name="customizeTag" type="text" class="text shiningTFD" maxlength="20" /> <input type="button" class="submit" id="addTag" value="<?php echo lang_add;?>" />
            </li>
        </ul>
            
        <h2 class="title foldedTitle" id="otherOptionKey"><b>+</b> <?php echo lang_more_option;?></h2>
        <ul class="box" id="otherOption">
            
            <?php
            	$taskOngoning = $task -> getFileTaskOngoing($id,'array');
				
			?>
            <li><label class="highBig"><?php echo lang_submit_to_contest ;?></label>
                 <div>
                <select name="task" id="task" <?php
					if( count($taskOngoning) > 0 ) echo ' disabled="disabled"';
				?>>
                <option value="">Select...</option>
				<?php 
					$tasks = $dbs -> select('SELECT * FROM `'.DB_PRE.'task` WHERE `timeEnd` >= "'. date('Y-m-d',time()) .'" ');
					foreach($tasks as $taskAttend){
						$taskAttendId = $encrypt -> code( $taskAttend['id']);
						$selected = in_array( $taskAttendId , $taskOngoning);
						$selected = $selected ? 'selected="selected"' : '';						 
				?><option <?php echo $selected;?> value="<?php echo $taskAttendId;?>"><?php echo $taskAttend['name'];?></option>
                <?php
					}
				?>
                </select>
                </div>
            </li>
            <hr />
            
            <li><label class="highBig"><?php echo lang_works_description ;?></label><textarea class="shiningTFD" cols="50" rows="8" id="description" name="description"><?php echo htmlShow($show['description'],'<b><br><p><a>');?></textarea><?php /*?><h4><?php echo lang_you_can_also_enter ;?><span id="descriptionNum" class="titleNum limitLen"></span><?php echo lang_characters ;?></h4><?php */?></li>
            
            <hr />
            <li><label class="highBig"><?php echo lang_works_thumb ;?></label>
                <div id="mediaThumbPhoto"><img src="<?php echo $show['thumb'] ? ROOT_PATH.$show['thumb'] : MEDIA_THUMB;?>" /></div>
                <input type="file" name="mediaThumb" id="mediaThumb" /><!--
                <div class="clear"></div>
                --><span class="tips"><?php echo lang_upload_thumb_tip;?></span>
                <div id="mediaThumbQueue"></div>
            </li>
            <hr />
            <li><label class="highBig"><?php echo lang_source_file ;?>（附件、报名表由此上传）</label><input type="file" name="mediaFileSource" id="mediaFileSource" /><span class="tips">(<?php echo lang_upload_source_tip;?>)</span></li>
            <div id="mediaFileSourceQueue">
            	<?php echo getMediaFiles($show['mediaSource'],$show['mediaSourceTitles']); ?>            
            </div>
            <hr />
            <li><label class="highBig"><?php echo lang_upload_source_download_password ?></label><input type="text" value="<?php echo $show['passWord'];?>" class="text shiningTFD" name="mediaPassWord" id="mediaPassWord" maxlength="20" /><div class="tips">(<?php echo lang_upload_password_tip;?>)</div></li>
        </ul>
        <div class="highOther">
        <input name="" type="submit" value="<?php echo lang_submit;?>" class="submit" /><input name="file_id" id="file_id" type="hidden" value="<?php echo $idCode;?>"  />
        </div>
        </form>
        </div><!--#upload-->
	</div><!-- .contents-->
</div>

<div class="pos posFooter"></div>
<div class="hidden">
	<div id="mediaTitleHtml">
    	<span class="addMediaTitle" onClick="addMediaTitle(this);"><?php echo lang_add_description ;?>1 </span>
        <span class="editMediaTitle" onClick="editMediaTitle(this)"></span>
    </div>
    
    <div id="mediaTitleTextarea">
    	<div class="mediaTitle">
        	<textarea name="mediaTitle"></textarea>
            <input onClick="saveMediaTitle(this)" type="button" class="submit" value="<?php echo lang_submit;?>" />
        </div>
    </div>
</div>
</body>
</html>
